# A Spam Comment Filter plugin by Hirotaka Ogawa (http://as-is.net/blog/)
# This is a simple example of Application-level Callback using MT3.1
#
# Release 0.01 (Aug 20, 2004)
#
# This software is provided as-is. You may use it for commercial or 
# personal use. If you distribute it, please keep this notice intact.
#
# Copyright (c) 2004 Hirotaka Ogawa

use strict;

if (MT->can('add_plugin')) {
    require MT::Plugin;
    my $plugin = new MT::Plugin();
    $plugin->name("Spamfilter Plugin, v.0.01");
    $plugin->description("Reject ASCII-only Comments (An example of Application-level Callback)");
    $plugin->doc_link("http://as-is.net/blog/archives/000902.html");
    MT->add_plugin($plugin);
}

MT->add_callback('CommentFilter', 10, 'Reject ASCII-only Comments', sub {
    my ($eh, $app, $comment) = @_;
    return ($comment->text =~ /[\x80-\xff]/);
});

1;
